package cn.javass.dp.signleton.example1;

/**
 * 懒汉式 双重检查锁
 */
public class Signleton2 {
    private Signleton2() {
    }

    private static volatile  Signleton2 signleton2;

    private static Signleton2  getInstance() {
            if (signleton2 == null) {
                synchronized (Signleton2.class) {
                    if (signleton2 == null) {
                        signleton2 = new Signleton2();
                    }
                }
            }
        return signleton2;
    }

}
